package net.zbus.loadbalance;

import net.zbus.BusClient;
import net.zbus.ClientPool;
import net.zbus.ClientPoolConfig;
import net.zbus.ZMsg;


public class ClientExample {
 
	public static void main(String[] args) throws InterruptedException { 
		ClientPoolConfig config = new ClientPoolConfig();
		config.setHost("172.24.180.27"); 
		config.setPort(15555);

		ClientPool pool = new ClientPool(config);
		
		BusClient client = pool.borrowClient();

		///////////////////////////////////////////////
		ZMsg msg = new ZMsg(); 
		msg.pushBack("lai");
		msg.pushBack(new byte[100]);
		
		for(int i=0;i<1000;i++){
			ZMsg res = client.request("echo", "", msg, 2500);  
			res.dump(); 
		}
		
		///////////////////////////////////////////////
		pool.returnClient(client);
		pool.destroy();
	}

}
